package com.example.demo.util;

import com.example.demo.model.Response;

import java.util.UUID;

public class Util {

    /**
     * 生成32位随机串
     * @return
     */
    public static String getUUID(){
        String uuid = UUID.randomUUID().toString().trim().replaceAll("-", "");
        return uuid;
    }

    public static Response initSuccessResponse(Object data) {
        Response response = new Response();
        response.setStatus(1);
        response.setErrCode("");
        response.setErrMsg("");
        response.setData(data);
        return response;
    }

    public static Response initfailResponse(String errCode, String errMsg) {
        Response response = new Response();
        response.setStatus(0);
        response.setErrCode(errCode);
        response.setErrMsg(errMsg);
        response.setData(null);
        return response;
    }
}
